<template>
  <div class="order-list">
    <NavHeader title="订单列表">
      <template v-slot:tip>
        <span>请谨防钓鱼链接或诈骗电话，了解更多></span>
      </template>
    </NavHeader>
    <div class="wrapper">
      <div class="container">
        <div class="order-box">
          <div class="order" v-for="item in (orderInfo.list || [])" :key="item.orderNo">
            <div class="order-title">
              <div class="item-info fl">
                {{item.createTime}}
                <span>|</span>
                {{item.receiverName}}
                <span>|</span>
                订单号：{{item.orderNo}}
                <span>|</span>
                {{item.paymentTypeDesc}}
              </div>
              <div class="item-money fr">
                <span>应付金额：</span>
                <span class="money">{{item.payment}}</span>
                <span>元</span>
              </div>
            </div>
            <div class="order-content clearfix">
              <div class="good-box fl">
                <div class="good-list" v-for="merchandise in (item.orderItemVoList || [])" :key="merchandise.productId">
                  <div class="good-img">
                    <img :src="merchandise.productImage" alt="">
                  </div>
                  <div class="good-name">
                    <div class="p-name">{{merchandise.productName}}</div>
                    <div class="p-money">{{merchandise.currentUnitPrice}} X {{merchandise.quantity}}元</div>
                  </div>
                </div>
              </div>
              <div class="good-state fr">
                <a href="javascript:;">{{item.statusDesc}}</a>
              </div>
            </div>
          </div>
          <div class="order-pagination">
            <el-pagination
              layout="prev, pager, next"
              :total="orderInfo.total"
              :page-size="pageSize"
              :current-page="pageNo"
              @current-change="pageChange"
              >
            </el-pagination>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import NavHeader from './../../components/NavHeader_s'
  import request from '../../request'
  export default{
    name:'order',
    data() {
      return {
        orderInfo: {},
        pageSize: 10,
        pageNo: 1,
      }
    },
    components:{
      NavHeader
    },
    mounted() {
      request.get('/order', { pageSize: this.pageSize, pageNo: this.pageNo })
        .then(({ data }) => {
          this.orderInfo = data;
        })
    },
    methods: {
      pageChange(pageNo) {
        request.get('/order', { pageSize: this.pageSize, pageNo: this.pageNo })
        .then(({ data }) => {
          this.pageNo = pageNo
          this.orderInfo = data;
        })
      }
    }
  }
</script>
<style lang="scss">
  @import './../../assets/scss/config.scss';
  @import './../../assets/scss/mixin.scss';
  .order-list{
    .wrapper{
      background-color:$colorJ;
      padding-top:33px;
      padding-bottom:110px;
      .order-box{
        .order-pagination {
          width: 100%;
          text-align: right;
        }
        .order{
          @include border();
          background-color:$colorG;
          margin-bottom:31px;
          &:last-child{
            margin-bottom:0;
          }
          .order-title{
            @include height(74px);
            background-color:$colorK;
            padding:0 43px;
            font-size:16px;
            color:$colorC;
            .item-info{
              span{
                margin:0 9px;
              }
            }
            .money{
              font-size:26px;
              color:$colorB;
            }
          }
          .order-content{
            padding:0 43px;
            .good-box{
              width:88%;
              .good-list{
                display: flex;
                align-items: center;
                height:145px;
                .good-img{
                  width:112px;
                  img{
                    width:100%;
                  }
                }
                .good-name{
                  font-size:20px;
                  color:$colorB;
                }
              }
            }
            .good-state{
              @include height(145px);
              font-size: 20px;
              color:$colorA;
              a{
                color:$colorA;
              }
            }
          }
        }
        .pagination{
          text-align:right;
        }
        .el-pagination.is-background .el-pager li:not(.disabled).active{
          background-color: #FF6600;
        }
        .el-button--primary{
          background-color: #FF6600;
          border-color: #FF6600;
        }
        .load-more,.scroll-more{
          text-align:center;
        }
      }
    }
  }
</style>